<div class="bjui-pageContent">
    <form action="{:U('save_promotion')}" data-callback="dialogFormCall" data-toggle="validate" data-alertmsg="false" class="dialogForm">
        <input type="hidden" name="type" value="1"/>
        <input type="hidden" name="id" value="{$va.id}"/>
        <div class="form-group">
            <label class="x100">活动名称:</label>
            <input type="text" name="name" data-rule="required" value="{$va.name}"/>
        </div>
        <div class="form-group">
            <label class="x100">活动方式:</label>
            <select name="award_type" data-toggle="selectpicker" class="actsel">
                <option value="0">--请选择--</option>
                <option value="1" <if condition="$va.award_type eq '1'">selected</if>>满额打折</option>
                <option value="2" <if condition="$va.award_type eq '2'">selected</if>>满额优惠金额</option>
                <option value="3" <if condition="$va.award_type eq '3'">selected</if>>满额送积分</option>
                <option value="4" <if condition="$va.award_type eq '4'">selected</if>>满额送卷</option>
            </select>
        </div>
         <div class="form-group">
            <label class="x100">订单金额:</label>
            <input type="text" name="conditions" class="w100" value="{$va.conditions}"/> 
            <span class="text-warning">订单总额达到此金额，就促发优惠规则</span>
        </div>
        <div class="form-group act act1" style="display: none;">
            <label class="x100">折扣:</label>
            <input type="text" name="award_value_1" class="w100" value="{$va.award_value}"/> %
            <span class="text-warning">1-100 如果打9折，请输入90</span>
        </div>
        <div class="form-group act act2" style="display: none;">
            <label class="x100">优惠金额:</label>
            <input type="text" name="award_value_2" class="100" value="{$va.award_value}"/> 元
        </div>
        <div class="form-group act act3" style="display: none;">
            <label class="x100">积分:</label>
            <input type="text" name="award_value_3" class="w100" value="{$va.award_value}"/>
        </div>
        <div class="form-group act act4" style="display: none;">
            <label class="x100">代金券:</label>
            <select name="award_value_4" data-toggle="selectpicker">
                 <option value="0">--请选择--</option>
	             <volist name="coupon" id="co">
	                  <option value="{$co.id}" <if condition="$va['award_value'] eq $co['id']">selected</if>>{$co.name}</option>
	              </volist>
            </select>
        </div>
        <div class="form-group">
            <label class="x100">开始时间:</label>
            <input type="text" name="start_time" value="{$va.start_time}" data-rule="required" data-toggle="datepicker" data-pattern="yyyy-MM-dd HH:mm:ss" />
        </div>
        <div class="form-group">
            <label class="x100">结束时间:</label>
            <input type="text" name="end_time" value="{$va.end_time}" data-rule="required" data-toggle="datepicker" data-pattern="yyyy-MM-dd HH:mm:ss" />
        </div>
        <div class="form-group">
            <label class="x100">适用范围:</label>
            <input type="checkbox" name="user_group[]" value="all" id="prom_fanwei1" data-toggle="icheck" data-label="全部用户"  <if condition="in_array('all',$va['user_group'])">checked</if> />
            <volist name="group" id="go">
             <input type="checkbox" name="user_group[]" value="{$go.id}" id="prom_fanwei2" data-toggle="icheck" data-label="{$go.name}"  <if condition="in_array($go['id'],$va['user_group'])">checked</if> />
            </volist>
        </div>
        <div class="form-group clearfix">
            <label class="x100 text-top pull-left">活动介绍:</label>
            <div class="pull-left">
                <textarea name="intro"
                          data-toggle="kindeditor"
                          data-items="'source', '|', 'undo', 'redo', '|', 'preview', 'print', 'template', 'code', 'cut', 'copy', 'paste',
        'plainpaste', 'wordpaste', '|', 'justifyleft', 'justifycenter', 'justifyright',
        'justifyfull', 'insertorderedlist', 'insertunorderedlist', 'indent', 'outdent', 'subscript',
        'superscript', 'clearhtml', 'quickformat', 'selectall', '|', 'fullscreen', '/',
        'formatblock', 'fontname', 'fontsize', '|', 'forecolor', 'hilitecolor', 'bold',
        'italic', 'underline', 'strikethrough', 'lineheight', 'removeformat', '|', 'image', 'multiimage',
        'flash', 'media', 'insertfile', 'table', 'hr', 'emoticons', 'baidumap', 'pagebreak',
        'anchor', 'link', 'unlink', '|', 'about'"
                          style="width: 100%;"
                >
                {$va.intro}
                </textarea>
            </div>
        </div>
    </form>
</div>
<script>
    var type = {$va.award_type|default='0'};
    $(function () {
       type && $('.act').hide() && ($('.act'+type).show());
       $('.actsel').change(function () {
           this.value && $('.act').hide() && ($('.act'+this.value).show());
       }) ;
    });
</script>
<include file="Common/footer" ftype="save" />